import json
import logging as log

from locust import task
from com.maycur.gateway.common.base_entity import ApiTaskSet


class DepartmentTask(ApiTaskSet):

    @task
    def list_department(self):
        task_api = '/api/openapi/org/department/search'
        request_body = {
            "offset": 0,
            "pageSize": 10,
            "keyword": ""
        }
        headers = self.get_headers_with_content_type()
        with self.client.post(task_api, data=json.dumps(request_body), headers=headers, catch_response=True) as res:
            result_dto = self.parse_response(res)
            if result_dto is None:
                return

